package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.PesticideApplyTemporaryConMapper;
import com.ruoyi.consume.domain.PesticideApplyTemporaryCon;
import com.ruoyi.consume.service.IPesticideApplyTemporaryConService;

/**
 * 农药临时领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-27
 */
@Service
public class PesticideApplyTemporaryConServiceImpl implements IPesticideApplyTemporaryConService
{
    @Autowired
    private PesticideApplyTemporaryConMapper pesticideApplyTemporaryConMapper;

    /**
     * 查询农药临时领用
     *
     * @param pesticideApplyTemporaryId 农药临时领用ID
     * @return 农药临时领用
     */
    @Override
    public PesticideApplyTemporaryCon selectPesticideApplyTemporaryById(Long pesticideApplyTemporaryId)
    {
        return pesticideApplyTemporaryConMapper.selectPesticideApplyTemporaryById(pesticideApplyTemporaryId);
    }

    /**
     * 查询农药临时领用列表
     *
     * @param pesticideApplyTemporaryCon 农药临时领用
     * @return 农药临时领用
     */
    @Override
    public List<PesticideApplyTemporaryCon> selectPesticideApplyTemporaryList(PesticideApplyTemporaryCon pesticideApplyTemporaryCon)
    {
        return pesticideApplyTemporaryConMapper.selectPesticideApplyTemporaryList(pesticideApplyTemporaryCon);
    }

    /**
     * 新增农药临时领用
     *
     * @param pesticideApplyTemporaryCon 农药临时领用
     * @return 结果
     */
    @Override
    public int insertPesticideApplyTemporary(PesticideApplyTemporaryCon pesticideApplyTemporaryCon)
    {
        pesticideApplyTemporaryCon.setCreateTime(DateUtils.getNowDate());
        return pesticideApplyTemporaryConMapper.insertPesticideApplyTemporary(pesticideApplyTemporaryCon);
    }

    /**
     * 修改农药临时领用
     *
     * @param pesticideApplyTemporaryCon 农药临时领用
     * @return 结果
     */
    @Override
    public int updatePesticideApplyTemporary(PesticideApplyTemporaryCon pesticideApplyTemporaryCon)
    {
        pesticideApplyTemporaryCon.setUpdateTime(DateUtils.getNowDate());
        return pesticideApplyTemporaryConMapper.updatePesticideApplyTemporary(pesticideApplyTemporaryCon);
    }

    /**
     * 批量删除农药临时领用
     *
     * @param pesticideApplyTemporaryIds 需要删除的农药临时领用ID
     * @return 结果
     */
    @Override
    public int deletePesticideApplyTemporaryByIds(Long[] pesticideApplyTemporaryIds)
    {
        return pesticideApplyTemporaryConMapper.deletePesticideApplyTemporaryByIds(pesticideApplyTemporaryIds);
    }

    /**
     * 删除农药临时领用信息
     *
     * @param pesticideApplyTemporaryId 农药临时领用ID
     * @return 结果
     */
    @Override
    public int deletePesticideApplyTemporaryById(Long pesticideApplyTemporaryId)
    {
        return pesticideApplyTemporaryConMapper.deletePesticideApplyTemporaryById(pesticideApplyTemporaryId);
    }

    /**
     * 更新库存量表
     *
     * @param pesticideApplyTemporaryCon 农药临时领用
     * @return 结果
     */
    @Override
    public int updateAmount(PesticideApplyTemporaryCon pesticideApplyTemporaryCon){
        return pesticideApplyTemporaryConMapper.updateAmount(pesticideApplyTemporaryCon);
    }

    /**
     * 更新领用状态
     *
     * @param pesticideApplyTemporaryId 农药临时领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long pesticideApplyTemporaryId){
        return pesticideApplyTemporaryConMapper.updateConsumeStatus(pesticideApplyTemporaryId);
    }

    /**
     * 退回操作
     *
     * @param pesticideApplyTemporaryId 农药临时领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long pesticideApplyTemporaryId){
        return pesticideApplyTemporaryConMapper.updateApprovalStatus(pesticideApplyTemporaryId);
    }
}
